/**
 * 
 */
package com.java.test.datacenter.dto;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;

import org.springframework.jdbc.core.RowMapper;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * @author 入款统计
 *
 */
public class PayInmentInfo implements RowMapper<PayInmentInfo>{

	// 入款账户
	private String bankAcount;

	// 入款渠道
	private String channelName;

	// 入款笔数
	private int count;

	// 总计金额
	private double sumAmount;

	// 最新一笔入款时间
	private LocalDateTime newComeTime;
	
	
	// 查询条件
	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private LocalDateTime startTime;
	
	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private LocalDateTime  endTime;
	
	
	

	public LocalDateTime getStartTime() {
		return startTime;
	}

	public void setStartTime(LocalDateTime startTime) {
		this.startTime = startTime;
	}

	public LocalDateTime getEndTime() {
		return endTime;
	}

	public void setEndTime(LocalDateTime endTime) {
		this.endTime = endTime;
	}


	public String getBankAcount() {
		return bankAcount;
	}

	public void setBankAcount(String bankAcount) {
		this.bankAcount = bankAcount;
	}

	public String getChannelName() {
		return channelName;
	}

	public void setChannelName(String channelName) {
		this.channelName = channelName;
	}

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	public double getSumAmount() {
		return sumAmount;
	}

	public void setSumAmount(double sumAmount) {
		this.sumAmount = sumAmount;
	}

	public LocalDateTime getNewComeTime() {
		return newComeTime;
	}

	public void setNewComeTime(LocalDateTime newComeTime) {
		this.newComeTime = newComeTime;
	}

	@Override
	public PayInmentInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
		
		PayInmentInfo info  = new PayInmentInfo();
		info.setBankAcount(rs.getString("bank_account"));
		info.setChannelName(rs.getString("channel_name"));
		info.setCount(rs.getInt("count"));
		info.setNewComeTime(rs.getTimestamp("new_come_time").toInstant().atZone(ZoneOffset.ofHours(8)).toLocalDateTime());
		info.setSumAmount(rs.getDouble("sum_amount"));
		
		return info;
	}

	
}
